package org.example.score.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.score.domain.Byzhxlqk;
import org.example.score.domain.Gccch;
import org.example.score.service.GccchService;
import org.example.score.mapper.GccchMapper;
import org.example.util.result.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author abc
* @description 针对表【pd_gccch】的数据库操作Service实现
* @createDate 2025-03-10 09:46:30
*/
@Service
public class GccchServiceImpl extends ServiceImpl<GccchMapper, Gccch>
    implements GccchService {

    @Autowired
    private GccchMapper gccchMapper;

    @Override
    public Double getScores(Parameter parameter) {
        Double res = -1.0;
        String school = parameter.getSchool();
        String code = parameter.getCode();
        String nameInSchool = parameter.getNameInSchool();
        QueryWrapper<Gccch> queryWrapper = new QueryWrapper();
        queryWrapper.eq("xxdm", school)
                .eq("zydm", code)
                .eq("xnzymc", nameInSchool);
        List<Gccch> tmp = gccchMapper.selectList(queryWrapper);
        if (tmp.isEmpty()) return res;
        else res = tmp.get(0).getZtzydf();
        return res;
    }
}




